<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <title>陆道原乡产品报价管理系统</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <link rel="stylesheet" href="__STATIC__/layui/css/layui.css">
    <link rel="stylesheet" href="__CSS__/admin.css">
    <!--[if lt IE 9]>
    <script src="__JS__/html5shiv.min.js"></script>
    <script src="__JS__/respond.min.js"></script>
    <style>
        .login .login-form input {
            color: #000;
        }
    </style>
    <![endif]-->
</head>
<body class="login">
<div class="login-title">陆道原乡后台系统</div>
<form class="layui-form login-form" action="" method="">
    <div class="layui-form-item">
        <label class="layui-form-label">用户名</label>
        <div class="layui-input-block">
            <input type="text" name="username" required lay-verify="username" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">密码</label>
        <div class="layui-input-block">
            <input type="password" name="password" required lay-verify="password" class="layui-input">
        </div>
    </div>
    <div class="layui-inline">
        <label class="layui-form-label">验证码</label>
        <div class="layui-input-inline">
            <input type="captcha" name="captcha" required lay-verify="captcha" class="layui-input" style="width: 204px">
        </div>&nbsp;&nbsp;&nbsp;
        <div class="layui-input-inline">{:captcha_img()}</div>
    </div>
    <br><br>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="loginForm">登 录</button>
        </div>
    </div>
</form>
<div class="login-form" style="padding-top: 20%;">
    <div class="layui-input-block" style="text-align: center">
        <img src="/logo.png" style="width: 80%">
    </div>
</div>

<script type="text/javascript">
</script>
<script src="__JS__/jquery.min.js"></script>
<script src="__STATIC__/layui/layui.js"></script>
<script>
    layui.use(['form'], function () {
        var form = layui.form;
        var $ = layui.jquery;

        form.on('submit(loginForm)', function (data) {
            var load = layer.load();
            $.ajax({
                url: "{:url('Login/doLog')}",
                type: "POST",
                data: data.field,
                dataType: 'json',
                success: function (res) {
                    if (1 == res.code) {
                        layer.msg(res.msg, {icon: 1}, function () {
                            window.location = "{:url('Index/index')}";
                        });
                    } else {
                        layer.msg(res.msg, {icon: 2});
                    }
                    layer.close(load);
                }
            });
            return false;
        });
    });
</script>
</body>
</html>